<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2017/7/24
  Time: 14:43
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<html>
<head>
    <title>DELETE</title>
</head>
<body>
删除的用户名：<input type="text" name="userName" id="userName">
             <input type="button" onclick="cutout()" value="删除">

<script src="${ctx}/common/js/jQuery-2.1.4.min.js"></script>
<script>
  function cutout(){
    var userName = $("#userName").val().trim();
    if(!userName){
      alert("用户名不能为空");
      return;
    }

    $.ajax({
      url:"${ctx}/cutOut.action",
      type: "POST",
      datatype:"json",
      data:{
        userName: userName
      },
      success:function(result){
        if(!result.success) {
          alert(result.error);
        } else {
          alert("删除成功！")
        }
      }
    });
  }
</script>
</body>
</html>
